#ifndef SGNODE_H_
#define SGNODE_H_

#include <string>
#include <map>
#include <cal3d.h>

namespace Lame3d
{
	class SGNode
	{
		public:
			SGNode(const std::string &n);
			virtual ~SGNode();
			
			const std::string& Name() const;
			
			const CalVector& Displacement() const;
			CalVector& Displacement();
			
			const CalQuaternion& Rotation() const;
			CalQuaternion& Rotation();
			
			void AddChild(SGNode *s);
			void RemoveChild(const std::string &s);
			SGNode* operator[](const std::string &s);
			
			virtual void MakeAbsolute();
			const CalVector& AbsoluteDisplacement();
			
		protected:
			std::string name;
			
			CalVector displacement;
			CalQuaternion rotation;
			
			std::map<std::string, SGNode*> children;
			
			SGNode *parent;
			
			CalVector absoluteDisplacement;
			
			bool isAbsolute() const;
			void unsetAbsolute();
			
		private:
			bool _isAbsolute;
	};
}

#endif /*SGNODE_H_*/
